<template>
  <ul class="nav-insertion">
    <li v-for="(item, index) in iconfonts" :key="index" :class="{checked: index == nowIndex}"  @click="relationClick(index)">
    <i
      :class="{
        iconfont: true,
        ['icon-' + item.icon]: true
      }"
      :title="item.title"
     
    ></i>
    {{item.title}}
  </li>

  </ul>
</template>

<script>
import { ref, watch } from "vue";
export default {
  props: {
    isiconTitle: {
      type: Boolean,
    },
  },
  setup(props) {
    watch(
      () => props.isiconTitle,
      (current) => {
        console.log(current);
      },
      { immediate: true }
    );
    const nowIndex = ref(null);
    const iconfonts = ref([
      { icon: "biaoge1", title: "表格" },
      { icon: "tupian", title: "图片" },
      { icon: "circle", title: "圆形" },
      { icon: "zhixian", title: "直线" },
      { icon: "juxing", title: "矩形" },
      { icon: "mulu", title: "目录" },
      { icon: "yemashezhi", title: "页码" },
      { icon: "dianziqianzhang", title: "签章区域" },
      { icon: "qianzi", title: "签字区域" },
    ]);

    const relationClick = (value) => {
      nowIndex.value = value;
    };

    return {
      iconfonts,
      nowIndex,
      relationClick,
    };
  },
};
</script>

<style lang="scss" scoped>
@import url("//at.alicdn.com/t/font_1012213_co9ut5sqaed.css");

.nav-insertion {
  display: inline-block;
  li {
    margin-left: 24px;
    padding: 4px;
    display: inline-block;
    i{
      font-size: 22px;
      vertical-align: middle;
    }
    &:hover {
      transition: 0.3s all;
      background-color: #eaecf0;
    }
  }
  svg {
    vertical-align: middle;
  }
}
.checked {
  color: #6092e7;
}
</style>
